package com.lb.shopguide.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lb.shopguide.R;
import com.lb.shopguide.entity.SettingsItem;

import java.util.List;

/**
 * Created by kang on 2017/6/10.
 */

public class AdapterSettingsItem extends BaseMultiItemQuickAdapter<SettingsItem, BaseViewHolder> {
    public AdapterSettingsItem(Context context, List<SettingsItem> data) {
        super(data);
        addItemType(SettingsItem.NORMAL_SETTINGS, R.layout.item_settings);
        addItemType(SettingsItem.LAST_SETTINGS, R.layout.item_last_settings);
    }

    @Override
    protected void convert(BaseViewHolder helper, SettingsItem item) {
        View view = helper.itemView;

        switch (helper.getItemViewType()) {
            case SettingsItem.NORMAL_SETTINGS:
                TextView tvItemNum = view.findViewById(R.id.tv_item_number);
                TextView tvItemName = view.findViewById(R.id.tv_item_name);
                tvItemName.setText(item.getItemName());
                tvItemNum.setText("" + item.getItemNum());
                break;
            case SettingsItem.LAST_SETTINGS:
                break;
        }
    }
}
